<?php
$_doctorReviews = array();
$row = 0;
$col = 0;
foreach ($doctorReviews as $doctorReview)
{
    $_doctorReviews[$row][$col] = $doctorReview;
    $col++;

    // make sure you create a row of 4 reviews
    if (fmod($col, 3) == 0)
    {
        $col = 0;
        $row++;
    }
}
?>
<?php //gfToolkit::debug($_doctorReviews)        ?>
<div id="member-reviews">
    <?php foreach ($_doctorReviews as $_row): ?>
        <div class="member-review-row">
            <?php foreach ($_row as $_doctorReview): ?>
                <div class="member-review">
                    <span class="author">
                        <strong><?php echo $_doctorReview->getMember()->getUser() ?></strong>
                    </span>
                    <span class="review-date">on <?php echo $_doctorReview->getCreatedAt() ?></span>
                    <div class="review-ratings-line">
                        <div class="review-rating" id="review-rating-<?php echo $_doctorReview->getId() ?>" doctorreviewid="<?php echo $_doctorReview->getId() ?>">
                            <?php include_partial("doctor_review/rating", array("doctorReview" => $_doctorReview)) ?>
                        </div>
                    </div>
                    <p class="review-text">
                        <?php echo $_doctorReview->getComment() ?>
                    </p>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endforeach; ?>
</div>   
<?php if (count($_doctorReviews) > 0): ?>
    <div class="slider-navigation">
        <?php for ($i = 1; (count($_doctorReviews) > 1 && $i <= count($_doctorReviews)); $i++): ?>
            <a href="::javascript;" class="nav">
                <span><?php echo $i ?></span>
            </a>
        <?php endfor; ?>
    </div>
<?php else: ?>
    <div class="no-items">Currently there's no member reviews submitted :)</div>
<?php endif; ?>
<script type="text/javascript">
    $(document).ready(function(){        
        $('#Member-reviews').cycle({            
            fx:     'scrollHorz',
            pager:  '.slider-navigation',
            timeout: 0,
            pagerAnchorBuilder: function(idx, slide) {
                // return selector string for existing anchor
                return '.slider-navigation a:eq(' + idx + ')';
            }
        });
    });
</script>
